package io.change_stream;

import java.io.*;

public class Test2 {
    public static void main(String[] args) throws IOException {
        // 使用缓冲流包装转换流
        method1();
        /*BufferedWriter bw = new BufferedWriter(
                new OutputStreamWriter(
                        new FileOutputStream(
                                "AdvancedCode/src/io/change_stream/info.txt",
                                true
                        ),
                        "GBK"
                )
        );
        bw.newLine();
        bw.write("在一起叫,梦");
        bw.newLine();
        bw.write("分开了叫,痛");
        bw.close();*/
    }

    private static void method1() throws IOException {
        BufferedReader br = new BufferedReader(
                new InputStreamReader(
                        new FileInputStream(
                                "AdvancedCode/src/io/change_stream/info.txt"
                        ),
                        "GBK"
                )
        );
        String str;
        while ((str = br.readLine()) != null) {
            System.out.println(str);
        }
        br.close();
    }
}
